// 获取session存储的对应vuex数据
export default function initData(moduleName: any, key: any) {
  if (!moduleName || !key) throw new Error('key参数必填！')
  if (moduleName === 'user') {
    return (
      window.localStorage.getItem(moduleName) &&
      JSON.parse(window.localStorage.getItem(moduleName) ?? '')[key]
    )
  }
  return (
    window.sessionStorage.getItem(moduleName) &&
    JSON.parse(window.sessionStorage.getItem(moduleName) ?? '')[key]
  )
}
